﻿using System.Globalization;
using System.Net.Http.Formatting;
using Newtonsoft.Json.Serialization;

namespace PAMD.Data.Ajax.Services.Common
{
    public static class ResponseHelper
    {
        public static JsonMediaTypeFormatter JSonFormatter
        {
            get
            {
                var formatter = new JsonMediaTypeFormatter();
                var json = formatter.SerializerSettings;

                json.DateFormatHandling = Newtonsoft.Json.DateFormatHandling.MicrosoftDateFormat;
                json.DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc;
                json.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;
                json.Formatting = Newtonsoft.Json.Formatting.Indented;
                json.ContractResolver = new CamelCasePropertyNamesContractResolver();
                json.Culture = new CultureInfo("en-US");

                return formatter;
            }
        }
    }
}